//影院前台service
export default {
    create: ({ name, address, phone, status } = {}) =>
        new Promise(resolve => {
            $.ajax({
                url: '/api/cinemas/create',
                type: 'POST',
                data: { name, address, phone, status },
                success: data => resolve(data)
            });
        }),
    get: ({ name, address, phone, status } = {}) =>
        new Promise(resolve => {
            $.ajax({
                url: '/api/cinemas/cinemas',
                type: 'GET',
                data: { name, address, phone, status },
                success: data => resolve(data)
            });
        }),

    delete: _id =>//删除
        new Promise(resolve => {
            $.ajax({
                url: `/api/cinemas/${_id}`,
                type: 'DELETE',
                success: data => resolve(data)
            });
        }),
    update: (_id,data) => new Promise(resolve => {//修改
            $.ajax({
                url: `/api/cinemas/${_id}`,
                type: 'PATCH',
                data: data,
                success: data => resolve(data)
            });
        }),
        setcinemas:(cinemas)=>{localStorage[cinemas_name]=JSON.stringify(cinemas);},
}